<div class="wrapper wrapper-content">
    <div class="container">
        <div class="row">
            <div class="col-md-9">
                <?php foreach ($post as $item): ?>
                    <div class="ibox article-list">
                        <div class="ibox-content">
                            <a href="/welcome/article/<?php echo $item['post_id']; ?>" class="btn-link">
                                <h2><?php echo $item['post_title']; ?></h2>
                            </a>
                            <div class="small m-b-xs">
                                <?php if ($item['cat_id']) { ?>
                                    <a href="#" data-id="<?php echo $item['cat_id']; ?>" class="btn btn-outline btn-primary btn-sm">
                                        <?php echo $item['cat']['cat_name']; ?>
                                    </a>
                                <?php } else { ?>
                                    <a href="javascript:;" class="btn btn-outline btn-primary btn-sm">
                                        暂无分类
                                    </a>
                                <?php } ?>
                            </div>
                            <div class="post-wrapper">
                                <?php echo $item['post_content']; ?>
                            </div>
                            <div class="row">
                                <div class="col-md-6">
                                    <h5>标签：</h5>
                                    <?php if ($item['tags']) { ?>
                                        <?php foreach ($item['tags'] as $tag_item): ?>
                                            <span class="badge badge-info"><?php echo $tag_item['tag_name']; ?></span>
                                        <?php endforeach; ?>
                                    <?php }else { ?>
                                        <span class="badge badge-info">空</span>
                                    <?php } ?>
                                </div>
                                <div class="col-md-6" >
                                    <h5>状态：</h5>
                                    <div>
                                        <i class="fa fa-clock-o"></i>
                                        <?php echo date('Y-m-d', $item['post_create_time']); ?>
                                    </div>
                                    <i class="fa fa-eye"></i>
                                    <?php echo $item['post_views'] . ' 阅读'; ?>
                                </div>
                            </div>
                        </div>
                    </div>
                <?php endforeach; ?>
            </div>

            <div class="col-md-3">
                <form method="post" action="#" class="panel-body">
                    <div class="input-group">
                        <input type="text" name="keyword" class="form-control">
                        <span class="input-group-btn">
                            <button type="submit" class="btn btn-primary">
                                <i class="fa fa-search"></i>
                            </button>
                        </span>
                    </div>
                </form>

                <div class="panel panel-primary">
                    <div class="panel-heading">
                        最新文章
                    </div>
                    <ul class="list-group">
                        <?php foreach ($post_list as $item): ?>
                            <li class="list-group-item">
                                <a href="/welcome/article/<?php echo $item['post_id']; ?>" title="<?php echo date('Y-m-d', $item['post_create_time']); ?>">
                                    <?php echo $item['post_title']; ?>
                                </a>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                </div>

                <div class="panel panel-primary">
                    <div class="panel-heading">
                        分类
                    </div>
                    <ul class="list-group">
                        <?php foreach ($cat_list as $item): ?>
                            <li class="list-group-item">
                                <span class="badge badge-default"><?php echo $item['count']; ?></span>
                                <a href="#" data-id="<?php echo $item['cat_id']; ?>"><?php echo $item['cat_name']; ?></a>
                            </li>
                        <?php endforeach; ?>
                    </ul>
                </div>

                <div class="panel panel-primary">
                    <div class="panel-heading">
                        标签
                    </div>
                    <div class="panel-body">
                        <?php foreach ($tag_list as $item): ?>
                            <a class="btn btn-outline btn-link" href="#" data-id="<?php echo $item['tag_id']; ?>">
                                <?php echo $item['tag_name']; ?>
                            </a>
                        <?php endforeach; ?>
                    </div>
                </div>

            </div>
        </div>
    </div>
</div>

